
<table border='0' style='width: 100%'>
    <tr>
        <th>Id</th>
        <th>Alias</th>
        <th>Address</th>
        <th>City</th>
        <th>State</th>
        <th>Postal Code</th>
        <th>Default Capacity</th>
        <th>Max. Capacity</th>
        <th>Size</th>
        <th>Date Added</th>
        <th>Status</th>
    </td>
<?php
foreach($screens as $screen)
{
  echo'<tr>';
    echo'<td>'.$screen['id'].'</td>';
    echo'<td>'.$screen['alias'].'</td>';
    echo'<td>'.$screen['address'].'</td>';
    echo'<td>'.$screen['city'].'</td>';
    echo'<td>'.$screen['state'].'</td>';
    echo'<td>'.$screen['postal_code'].'</td>';
    echo'<td>'.$screen['ad_capacity'].'</td>';
    echo'<td>'.$screen['ad_capacity_max'].'</td>';
    echo'<td>'.$screen['size'].'</td>';
    echo'<td>'.$this->date->format($screen['date_added'],'STANDARD_DATE').'</td>';
    echo'<td>'.$screen['status'].'</td>';
    echo'<td>'.'<span class="link screenEdit" data-id="'.$screen['id'].'">edit</span> | <span class="link screenDelete" data-id="'.$screen['id'].'">delete</span>'.'</td>';
  echo'</tr>';
}
?>
</table>
<script type="text/javascript">
$(document).ready(function(){
    $('.screenEdit').click(function(){
        var id = $(this).attr('data-id');
       
       $.ajax({
           statusCode : { 404: function(){alert('Not Found');} },
           type       : 'POST',
           data       : {id : id},
           url        : '../ajax/ir_edit_screen',
           success    : function(res){
                            $('#divScreenInfo').html(null);
                            $('#divScreenInfo').html(res);
                        }
       });
       
    });
    
    $('.screenDelete').click(function(){
        var id = $(this).attr('data-id');
       if (confirm("Are you sure?")) {
            $.ajax({
                statusCode : { 404: function(){alert('Not Found');} },
                type       : 'POST',
                data       : {id : id},
                url        : '../ajax/ir_delete_screen',
                success    : function(res){
                                 alert(res);
                              //   $('#divScreenInfo').html(null);
                              //   $('#divScreenInfo').html(res);
                             }
            });
        }
        return false;
    });
    
    
});
</script>